﻿using System.Xml.Linq;
using Microsoft.SharePoint.Administration;
using SPContrib.Extensions;

namespace SPContrib.SharePoint.Extensions
{
    /// <summary>
    /// Extensions for the SPElementDefinition class
    /// </summary>
    public static class SPElementDefinitionExtensions
    {
        /// <summary>
        /// Returns an instance of XElement that represents the SPElementDefinition (i.e. the element tree within the Element Tag)
        /// </summary>
        public static XElement AsXml(this SPElementDefinition instance)
        {
            return instance.XmlDefinition
                            .AsXElement()
                            .RemoveNamespaces();         
        }
    }
}
